package com.vito.oa.act.print;

import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * 审批单导出数据结构实体
 * @author pc
 * 
 */
public class PrintInfo implements Serializable,Comparable<PrintInfo> {

	private static final long serialVersionUID = 413126988895851626L;
	/**
	 * 流程名称
	 */
	private String processName;
	/**
	 * 打印标题
	 */
	private String title;
	/**
	 * 流程发起人
	 */
	private String startUser;
	/**
	 * 流程发起人部门
	 */
	private String startUserDept;
	/**
	 * 发起时间
	 */
	private String startTime;
	/**
	 * 结束时间
	 */
	private String endTime;
	/**
	 * 状态
	 */
	private String statusText;
	/**
	 * 发起人所属企业
	 */
	private String companyName;
	/**
	 * 打印时间
	 */
	private String printTime;
	/**
	 * 打印人
	 */
	private String printPersion;
	/**
	 * pdf保存路径
	 */
	private String filePath;
	/**
	 * pdf名称
	 */
	private String fileName;
	/**
	 * 首节点表单
	 */
	private Map<String, Object> mainForm;
	/**
	 * 所有节点表单
	 */
	private List<Map<String, Object>> forms;
	/**
	 * 各节点审批状态
	 */
	private ArrayList<Approval> approvalInfo;

	public String getProcessName() {
		return processName;
	}

	public void setProcessName(String processName) {
		this.processName = processName;
	}

	public String getStartTime() {
		return startTime;
	}

	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}

	public String getEndTime() {
		return endTime;
	}

	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}

	public String getStatusText() {
		return statusText;
	}

	public void setStatusText(String statusText) {
		this.statusText = statusText;
	}

	public Map<String, Object> getMainForm() {
		return mainForm;
	}

	public void setMainForm(Map<String, Object> mainForm) {
		this.mainForm = mainForm;
	}

	public String getFilePath() {
		return filePath;
	}

	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getCompanyName() {
		return companyName;
	}

	public void setCompanyName(String companyName) {
		this.companyName = companyName;
	}

	public ArrayList<Approval> getApprovalInfo() {
		return approvalInfo;
	}

	public void setApprovalInfo(ArrayList<Approval> approvalInfo) {
		this.approvalInfo = approvalInfo;
	}

	public String getPrintTime() {
		return printTime;
	}

	public void setPrintTime(String printTime) {
		this.printTime = printTime;
	}

	public String getPrintPersion() {
		return printPersion;
	}

	public void setPrintPersion(String printPersion) {
		this.printPersion = printPersion;
	}

	public String getStartUser() {
		return startUser;
	}

	public void setStartUser(String startUser) {
		this.startUser = startUser;
	}

	public String getStartUserDept() {
		return startUserDept;
	}

	public void setStartUserDept(String startUserDept) {
		this.startUserDept = startUserDept;
	}

	public List<Map<String, Object>> getForms() {
		return forms;
	}

	public void setForms(List<Map<String, Object>> forms) {
		this.forms = forms;
	}

	public static class Approval implements Serializable {
		private static final long serialVersionUID = 5706260260572825637L;
		public String persionName;
		public String agreed;
		public String time;
		public String nodeName;
		public String formTitle;

		public Approval() {

		}

		public Approval(String persionName, String agreed, String time, String nodeName, String formTitle) {
			super();
			this.persionName = persionName;
			this.agreed = agreed;
			this.time = time;
			this.nodeName = nodeName;
			this.formTitle = formTitle;
		}

		public String getFormTitle() {
			return formTitle;
		}

		public void setFormTitle(String formTitle) {
			this.formTitle = formTitle;
		}

		public String getNodeName() {
			return nodeName;
		}

		public void setNodeName(String nodeName) {
			this.nodeName = nodeName;
		}

		public String getPersionName() {
			return persionName;
		}

		public void setPersionName(String persionName) {
			this.persionName = persionName;
		}

		public String getAgreed() {
			return agreed;
		}

		public void setAgreed(String agreed) {
			this.agreed = agreed;
		}

		public String getTime() {
			return time;
		}

		public void setTime(String time) {
			this.time = time;
		}

		@Override
		public String toString() {

			return persionName + " | " + agreed + " | " + time + ";";
		}

	}

	@Override
	public int compareTo(PrintInfo o) {
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
		Date date1 = null;
		Date date2 = null;
		try {
			date1 = format.parse(this.startTime);
			date2 = format.parse(o.getStartTime());
		} catch (ParseException e) {
			return 0;
		}
		return date1.compareTo(date2);
	}
	
}
